from flask import Blueprint

blog = Blueprint('blog', __name__)

from myblog.views import *

index_view = BlogIndex.as_view('blog_index')

# 分页函数
blog.add_url_rule('/index/<int:page>/', view_func=index_view)
# 首页函数
blog.add_url_rule('/index/', view_func=index_view)

# 分类函数
blog.add_url_rule('/category/<int:id>/', view_func=CategoryPage.as_view('category_page'))

blog.add_url_rule('/post/', view_func=BlogPost.as_view('blog_post'))
blog.add_url_rule('/profile/<filename>/', view_func=SendFile.as_view('send_file'))
blog.add_url_rule('/page/<int:id>/', view_func=BlogDetail.as_view('blog_detail'))
blog.add_url_rule('/num/<int:id>/', view_func=NumBrowse.as_view('num_browse'))
blog.add_url_rule('/getdate/', view_func=GetDate.as_view('get_date'))

blog.add_url_rule('/category-blog/', view_func=CategoryBlog.as_view('category_blog'))
blog.add_url_rule('/blog-search/', view_func=BlogSearch.as_view('blog_search'))

blog.add_url_rule('/num-category/', view_func=NumCategory.as_view('num_category'))
